{include file="public/header" title="问答管理" /}
<div class="main">
    <div class="div mar1">

        <div class="right_box fl">
        	<div class="checkDiv">
            	<div class="fl"><input type="button" value="新 增" class="btn addBtn" onclick="url='{:url('index/questionlist/edit')}';window.location.href=url;" /><input type="hidden" value="全部删除" class="btn delBtn mar3" onclick="ShowDiv('MyDiv','fade')" /></div>
                <div class="fr"><input type="hidden" class="text textHe2" /><input type="hidden" value="查 询" class="btn infoBtn mar3" /></div>
            </div>
            <!--startprint-->
        	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table mar2">
                <tr>
                    <th>编号</th>
                    <th>题目</th>
                    <th>答案a</th>
                    <th>答案b</th>
                    <th>答案c</th>
                    <th>答案d</th>
                    <th>正确答案</th>
                    <th>操作</th>
                </tr>
            {foreach $list as $key=>$vo } 
                <tr>
     
                    <td>{$vo.question_id}</td>
                    <td>{$vo.ask}</td>
                    <td>{$vo.answer_a}</td>
                    <td>{$vo.answer_b}</td>
                    <td>{$vo.answer_c}</td>
                    <td>{$vo.answer_d}</td>
                    <td>{$vo.answer_right}</td>
                    <td><span><a href="javascript:void(0);" title="修改" class="edit" onclick="editClick({$vo.question_id});">&nbsp;</a>
                        <a href="javascript:void(0);" title="删除" class="del" onclick="deleteClick({$vo.question_id});">&nbsp;</a>
                    </span></td>
                </tr>
            {/foreach}
            </table>
			{:$list->render()}
            
            
            <!--弹出层时背景层DIV-->
            <div id="fade" class="black_overlay">
            </div>
            <div id="MyDelDiv" class="white_content">
                <div class="out_title"><p class="fl">提示</p><a href="#" class="close fr" onclick="CloseDiv('MyDelDiv','fade')" title="关闭">&nbsp;</a></div>
                <div class="out_content">
                    <h3><img src="" class="out_inpor" /><p class="prompt">确定要删除此项？</p></h3>
                </div>
                <form action='questionlist/delete' method='post'>
                    <input type="text" id="input_del_desc" name="ask" class="form-control" style="display: none" placeholder="题目" value='' readonly>
                    <input type="text" id="input_del_id" name="question_id" class="form-control" style="display: none" placeholder="题目id" value='' readonly>
                    <div class="out_info">
                        <div class="fr"><input type="submit" value="确&nbsp;定" class="btn infoBtn" /><input type="button" value="取&nbsp;消" class="btn defultBtn mar3" onclick="CloseDiv('MyDelDiv','fade')" /></div>
                    </div>
                </form>
            </div>
            <div id="MyDiv" class="white_content">
            	<div class="out_title"><p class="fl">提示</p><a href="#" class="close fr" onclick="CloseDiv('MyDiv','fade')" title="关闭">&nbsp;</a></div>
                <div class="out_content">
                	<h3><img src="" class="out_inpor" /><p class="prompt">确定要删除全部项？</p></h3>
                </div>
                <div class="out_info">
                	<div class="fr"><input type="button" value="确&nbsp;定" class="btn infoBtn" /><input type="button" value="取&nbsp;消" class="btn defultBtn mar3" /></div>
                </div>
            </div>

            <!--endprint-->
        </div>
    </div>
</div>

{include file="public/footer" menu_sel="menu_sel4" /}
</body>
<script type="text/javascript">
    $(document).ready(function(){
        rowClicked=function(ask, question_id){
            console.log('rowClicked');
            $("#input_del_desc").val(ask);
            $("#input_del_id").val(question_id);
        },
        rowUpdateClicked=function(group_name, group_id){
            console.log('rowClicked');
            $("#input_update_desc").val(group_name);
            $("#input_update_id").val(group_id);
        }        
    })
    
    function editClick(question_id){
    	var str = "?question_id="+question_id;
    	window.location.href = "{:url('index/questionlist/edit')}"+str;
    }
    function deleteClick(question_id){
    	if (confirm("确认删除吗？删除无法恢复！！！")){
        	var str = "?question_id="+question_id;
        	window.location.href = "{:url('index/questionlist/delete')}"+str;    		
    	}

    }    
</script>

</html>
